package durst.data;

import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;
import com.sdicons.json.mapper.JSONMapper;

import durst.data.dao.impl.InviteDao;
import durst.data.json.InviteJSONHelper;

@DatabaseTable(tableName = "Invite", daoClass = InviteDao.class)
public class Invite extends CSDEntity {
	public static final String INVITEE = "invitee_id";
	public static final String EVENT = "event_id";
	public static final String JUMPLIST = "jumplist";
	public static final String ID = "id";

	static { 
		JSONMapper.addHelper(new InviteJSONHelper());
	}
	
	@DatabaseField(generatedId = true, columnName = ID)
	private int id; 
	
	@DatabaseField(canBeNull = false, foreign = true, columnName = INVITEE)
	private Account invitee; 
	
	@DatabaseField(canBeNull = false, foreign = true, columnName = EVENT) 
	private Event event; 
	
	@DatabaseField(canBeNull = false, foreign = true)
	private UserCalendar alternate;
	
	@DatabaseField(columnName = JUMPLIST)
	private boolean jumplist;

	public Invite() {}
	
	public Invite(Account invitee, Event event, boolean jumplist) {
		this.invitee = invitee; 
		this.event = event; 
		this.jumplist = jumplist;
	}
	
	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public Account getInvitee() {
		return invitee;
	}

	public void setInvitee(Account invitee) {
		this.invitee = invitee;
	}

	public Event getEvent() {
		return event;
	}

	public void setEvent(Event event) {
		this.event = event;
	}

	public void setAlternate(UserCalendar alternateCalendar) {
		this.alternate = alternateCalendar;
	}

	public UserCalendar getAlternate() {
		return alternate;
	}

	public void setJumplist(boolean jumplist) {
		this.jumplist = jumplist;
	}

	public boolean isJumplist() {
		return jumplist;
	} 
}
